﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace supermarket.method
{
    internal class Classadmin
    {
        SqlConnection con = new SqlConnection();
        SqlCommand cmd = new SqlCommand();
        SqlDataReader qlddr = null;  //数据缓冲区

        #region///查询导出的内容
        public DataTable getadminall()
        {
            DataTable dt = new DataTable();
            try
            {
                string s;
                Classgetsql sqlcon = new Classgetsql();
                con = sqlcon.getcon();  //数据库已连接并打开
                                        //2.执行SQL语句（select）
                s = @"SELECT  [id] as '序号'
      ,[username] as '名称'
      ,[passwd] as '密码'
  FROM [Table_admin]";
                cmd = new SqlCommand(s, con);
                SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(cmd);
                sqlDataAdapter.Fill(dt);
                return dt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return dt;
            }
        }
        #endregion
    }
}
